#include <stdint.h>
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include "../usart.h"
#include "../ledmsg.h"
#include "../sandbox/adc.h"
#include "../sandbox/dac.h"

#ifndef F_CPU
#define F_CPU 16000000UL
#endif

int main()
{
	ledmsg("--");
//	char s[10];

	init_usart(38400);
	DDRB = 0xFF;
	init_adcfree(64,0,0);
	ADCSRA |= (1<<ADSC);

	while(1) {
		while(!(ADCSRA & (1<<ADIF))) _delay_us(5);
		PORTB = dacmap(ADCH);
	}

	return 1;
}
